<?php

	// $userinfo['username'] = 'Ritaa';
	// $userinfo['avatar_path'] = 'images/av1.jpg';
	// $userinfo['email'] = 'ritawijaya91@gmail.com';
	// $userinfo['gender'] = "Female";
	// $userinfo['about'] = "tes";
	// $userinfo['list of achivement'] = "";
	// $userinfo['num_comment'] = "";
	// $userinfo['num_content'] = "";
	//getUserinfo();
	
	
	connect();
	
	function loadLoginUser(&$userinfo) {
		// bagian ini jgn lupa dihapus, ganti fungsi redirect
		// $userinfo['username']=$_SESSION['username'];
		// $userinfo['email']=$_SESSION['email'];
		// $userinfo['avatar_path']=$_SESSION['avatar_path'];
		// $userinfo['gender']=$_SESSION['gender'];
		// $userinfo['about']=$_SESSION['about'];
		// $userinfo['achievement']=$_SESSION['achievement'];
		$userinfo = getUserInfo(getLoginUserid());
	}
	
	function loadUser($userid) {
		// bagian ini jgn lupa dihapus, ganti fungsi redirect
		$user=getUserInfo($userid);
		if ($user['ID_user']!=-1){
			$userinfo['username']=$user['username'];
			$userinfo['email']=$user['email'];
			$userinfo['avatar_path']=$user['avatar_path'];
			$userinfo['gender']=$user['gender'];
			$userinfo['about']=$user['about'];
			$userinfo['achievement']=$user['achievement'];
			$userinfo['contents']=$user['contents'];
		} else {
			$userinfo['username']="unregistered";
			$userinfo['email']="unregistered";
			$userinfo['avatar_path']="unregistered";
			$userinfo['gender']="unregistered";
			$userinfo['about']="unregistered";
			$userinfo['achievement']=array();
			$userinfo['contents']=array();
			return false;
		}
		return $userinfo;
	}
	
?>